// JavaScript Document
var u=location.pathname;
var u=u+"/index/flash";
var big_pic_arr = [];//大图数组
var fl_link_arr=[];//连接数组
var num=5;//数量
var time=3000;//速度 单位为毫秒
var currslid = 0;
var slidint;
$(function(){
   $.ajax({
	  type:'GET',
	  cache:true,
	  async:false,
	  dataType:'json',
	  url:u,
	  success:function(msg){
		   msg=eval(msg);
		   $.each(msg,function(i,n){
			   big_pic_arr[i]=n.fl_pic_1;
			   fl_link_arr[i]=n.fl_link;
		   });
	  }	  
   });
   playit();
});
function setfoc(id){
	$("#big_pic").attr("src",big_pic_arr[id]);//大图
	$("#fl_link").attr("href",fl_link_arr[id]);//连接
	currslid = id;
	for(i=0;i<num;i++){
		$("#thumb_"+i).addClass("middle_1_2");
		$("#thumb_"+i).removeClass("middle_1_2_current");
	};
	$("#thumb_"+id).addClass("middle_1_2_current");
	big_pic.style.visibility = "hidden";
	big_pic.filters[0].Apply();
	if (big_pic.style.visibility == "visible") {
		big_pic.style.visibility = "hidden";
		big_pic.filters.revealTrans.transition=23;
		big_pic.filters.revealTrans.duration=1;
	}
	else {
		big_pic.style.visibility = "visible";
		big_pic.filters[0].transition=23;
		big_pic.filters.revealTrans.duration=1;
	}
	big_pic.filters[0].Play();
	stopit();
}
function playnext(){
	if(currslid==num-1){
		currslid = 0;
	}else{
		currslid++;
	}
	setfoc(currslid);
	playit();
}
function playit(){
	slidint = setTimeout(playnext,time);
}
function stopit(){
	clearTimeout(slidint);
}